package controller;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class JDBCTest {

	public static void main(String[] args)throws Exception {
		Class.forName("com.mysql.jdbc.Driver");
		Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/csk", "root", "mysql");
		PreparedStatement pstm=con.prepareStatement("select * from student where xm=?");
		pstm.setString(1, "����");//ע������Ĳ�������ֵ�Ǵ�1��ʼ����һ�������ǲ�������ֵ���ڶ������ǲ���ֵ
		ResultSet rs=pstm.executeQuery();
		while(rs.next()){
			System.out.println("�����ǣ�"+rs.getString("xm")+"    רҵ���ǣ�"+rs.getString("zym"));
		}
		rs.close();
		pstm.close();
		con.close();
		

	}

}
